package com.lqd.mall.basis.code;

import lombok.AllArgsConstructor;

/**
 * @author 零起点
 * @create 2022-01-11 17:10
 */
@AllArgsConstructor
public enum  CommonCode implements ResultCode {
    /**
     * 操作成功提示
     */
    SUCCESS (true,200,"操作成功"),
    /**
     * 统一的错误提示信息
     */
    FAIL(false,99999,"操作失败"),
    INVALIDPARAM(false, 400,"非法参数!"),
    SERVER_ERROR(false,400,"抱歉，系统繁忙，请稍后重试！"),
    DATE_CONVERSION_FAILURE(false,400,"日期转换失败"),
    DATA_IS_EMPTY(false,400,"数据为NULL值"),
    UNAUTHENTICATED(false,401,"没有token");


    /**
     * 是否操作成功
     */
    private boolean success;
    /**
     * 状态码
     */
    private int code;
    /**
     * 显示信息
     */
    private String message;


    @Override
    public boolean success() {
        return success;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }
}
